function generateObject(obj1, obj2) {
  obj1.next = obj2;
  obj2.prev = obj1;

  return {
    o1: obj1,
    o2: obj2
  }
}

const obj = generateObject({ name: 'obj1' }, { name: 'obj2' });

// 这个时候，我们就无法在访问到对象{ name: 'obj1' }, 它就会被当做“垃圾”
delete obj.o1;
delete obj.o2.prev;


let fn1 = function () {
  this.foo = function () {
    console.log(1111);
  }
}

let f1 = new fn1();

let fn2 = function () {
}
fn2.prototype.foo = function () {
  console.log(1111);
}

let f2 = new fn2();


function Person() {
  this.name = 'person';
  this.age = 18;
  this.getAge = function() {
    return this.age;
  }
}

const p1 = new Person();
const a = p1.getAge();

function Person() {
  this.name = 'person';
  this.age = 18;
  this.getAge = function() {
    return this.age;
  }
}
const p2 = new Person();
const a = p2.age;

